﻿using AutoMapper;
using Lanbt.Core.Entity.Dto.lanbt_user;
using Lanbt.Core.Entity.EntityDB;
using Lanbt.Core.Repository.SqlService.IRepository;
using SqlSugar;

namespace Lanbt.Core.Repository.SqlService
{
    public class UserRepository : RepositoryBase<lanbt_user>, IUserRepository
    {
        private readonly IMapper _mapper;
        public UserRepository(ISqlSugarClient db,IMapper mapper) : base(db)
        {
            _mapper = mapper;
        }

        public async Task<QueryUsersOutput> GetUserById(string id, bool isAll = false)
        {
            var user = await FirstOrDefault(q => q.ID == id, isAll);
            return _mapper.Map<QueryUsersOutput>(user);
        }
    }
}
